@extends('admin.base.index')

@section('content')
 <!-- Deafult Table -->
    <div class="block-area" id="defaultStyle">
    <h3 class="block-title">商品评论管理</h3>
    <!--删除-->
    <form action="/admin/comt" method="post" name="myform">
        <input type="hidden" name="_token" value="{{csrf_token()}}">
        <input type="hidden" name="_method" value="DELETE">
    </form>

    <!--分页-->
        <form action='/admin/comt' method='get'>
        <div class='media-body'>
            商品名称：<input type='text' class='form-control m-b-5' name='goodname'>
        </div>

        <input type='submit' class='btn' value='搜索'>
    </form>
    </div>
    <div class="block-area" id="defaultStyle">
        <h3 class="block-title">Default Style</h3>
        <table class="table tile">
            <thead>
                <tr>
                    <th>id号</th>
                    <th>评论时间</th>
                    <th>评论内容</th>
                    <th>商品</th>
                    <th>评论人</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
            @foreach($list as $v)
                <tr>
                    <td>{{$v->id}}</td>
                    <td>{{date("Y-m-d H:i:s",$v->pubtime)}}</td>
                    <td><a href="/admin/comt/{{$v->id}}">{{$v->body}}</a></td>
                    <td>{{$v->goodname}}</td>
                    <td>{{$v->username}}</td>
                    <td>{{$v->state==0?'未回复':'已回复'}}</td>
                    <td>
                        <a href="javascript:doDel({{$v->id}})" class="btn">删除</a>
                        <a href="/admin/comt/{{$v->id}}/edit" class="btn">回复</a>
                    </td>
                </tr>
                    @endforeach
            </tbody>
        </table>
        <!--显示分页，并带上附加搜索参数-->
        {{$list->appends($where)->links()}}
        <script type="text/javascript">
            function doDel(id)
            {
                if(confirm("确定要删除吗?")){
                    var form =document.myform;
                    form.action = "comt/"+id;
                    form.submit()
                }
            }
        </script>
    </div>

 @stop
